Implement gdk_window_clear_area natively for foreign windows
authorAlexander Larsson <alexl@redhat.com>
Fri, 26 Jun 2009 13:45:53 +0000 (15:45 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 26 Jun 2009 13:45:53 +0000 (15:45 +0200)
This fixes a redraw issue with the notification area in xfce4.

gdk/gdkwindow.c
gdk/gdkwindowimpl.h
gdk/x11/gdkwindow-x11.c

index 077a876436bcfc71514d3abeac4cab14206f3210..665e01f78df63d9e27c33fa41c804c3f6faf1f39 100644 (file)
@@ -4059,6 +4059,16 @@ gdk_window_clear_area_internal (GdkWindow *window,
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
+  if (GDK_WINDOW_DESTROYED (window))
+    return;
+
+  if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
+    {
+      GDK_WINDOW_IMPL_GET_IFACE (private->impl)->clear_area
+       (window, x, y, width, height, send_expose);
+      return;
+    }
+
   /* This is what XClearArea does, and e.g. GtkCList uses it,
      so we need to duplicate that */
   if (width == 0)
index 5905de80f3f9f21693a54dc19a8b8efca73b949b..d12a872c5dd79991127c0a6ae8e121eaa0093415 100644 (file)
@@ -71,6 +71,12 @@ struct _GdkWindowImplIface
                                          GdkWindow       *new_parent,
                                          gint             x,
                                          gint             y);
+  void         (* clear_area)           (GdkWindow       *window,
+                                         gint             x,
+                                         gint             y,
+                                        gint             width,
+                                        gint             height,
+                                        gboolean         send_expose);
   
   void         (* set_cursor)           (GdkWindow       *window,
                                          GdkCursor       *cursor);
index 9caa17a163a6402a3c542babf83bad00c4f8b0a6..cd5a3778f655d6257eb38c4f6c2acc91cdf431e8 100644 (file)
@@ -1660,6 +1660,19 @@ gdk_window_x11_reparent (GdkWindow *window,
   return FALSE;
 }
 
+static void
+gdk_window_x11_clear_area (GdkWindow *window,
+                          gint       x,
+                          gint       y,
+                          gint       width,
+                          gint       height,
+                          gboolean   send_expose)
+{
+  XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
+             x, y, width, height,
+             send_expose);
+}
+
 static void
 gdk_window_x11_raise (GdkWindow *window)
 {
@@ -5556,6 +5569,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
   iface->set_background = gdk_window_x11_set_background;
   iface->set_back_pixmap = gdk_window_x11_set_back_pixmap;
   iface->reparent = gdk_window_x11_reparent;
+  iface->clear_area = gdk_window_x11_clear_area;
   iface->set_cursor = gdk_window_x11_set_cursor;
   iface->get_geometry = gdk_window_x11_get_geometry;
   iface->get_root_coords = gdk_window_x11_get_root_coords;